package com.itheima.health.controller;

import com.itheima.health.common.Globalconstant;
import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import com.itheima.health.util.QiniuUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;

/**
 * @author zhangmeng
 * @description 套餐控制器
 * @date 2019/9/26
 **/
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
public class MobileSetMealController {
    @Autowired
    private QiniuUtils qiniuUtils;

    @Autowired
    private SetMealService setMealService;
    @Autowired
    private RedisTemplate redisTemplate;


    //mobile/setmeal/findById?id=12
    @GetMapping("/findById")
    public Result upload(Integer id) {
        if (id == null) {
            return Result.error(null,"参数错误");
        }
        Setmeal setmeal = setMealService.selectSetMealByid(id);
        return Result.success(setmeal);

    }



    /*
    setmeal/getSetmeal
    GET
     */
    @GetMapping("/getSetmeal")
    public Result upload() {
        List<Setmeal> list = setMealService.selectAll();
        return Result.success(list);
    }

}
